home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 6702 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  69 lines

  1. Path: hearst.acc.Virginia.EDU!adastra!mbs
  2. Newsgroups: comp.sys.amiga.programmer
  3. From: mbs@adastra.cvl.va.us (Michael B. Smith)
  4. Subject: Re: Strange bug in window blocking Request() - comments please
  5. References:  <dave.0bmt@ccom.co.nz>
  6. X-NewsReader: GRn 3.1 March 23, 1996
  7. MIME-Version: 1.0
  8. Content-Type: text/plain; charset=iso-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Message-ID: <mbs.4apz@adastra.cvl.va.us>
  11. Date: Mon, 1 Apr 96 06:53:54 EDT
  12. Organization: Only if you insist...
  13.  
  14. In article <dave.0bmt@ccom.co.nz> dave@ccom.co.nz (David Eaves) writes:
  15. > elimination I think I have tracked it to the way in which I was using an
  16. > invisible requester to block window input.  Here is the original code:
  17. >
  18. >    InitRequester(req);
  19. >    req->LeftEdge = req->TopEdge = -1;
  20. >    req->Width = req->Height = 1;
  21. >    req->Flags = SIMPLEREQ | NOREQBACKFILL;
  22. >    Request(req, window);
  23. >
  24. > I am not sure where I got this piece of code from (I think I copied it
  25. > from someone else's source), but after reading up the RKM's and autodocs
  26. > it seems more correct to do just:
  27. >
  28. >    InitRequester(req);
  29. >    Request(req, window);
  30.  
  31. You may not remember, but in the very early 2.0 days, we had a
  32. huge flame war over this. :) Anyway, the guys at C= said this
  33. was the way to do it (and this is the way GRn/GMail/etc. do it
  34. and they run on everything from 2.04 up):
  35.  
  36. struct Requester disable_req = {
  37.     0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  38. };
  39.  
  40. int
  41.     windowDisableCount;
  42. struct Window
  43.     *mainWindow;
  44. ...
  45.  
  46. __inline void
  47. DisableWindow (void)
  48. {
  49.     if (!windowDisableCount)
  50.         Request (&disable_req, mainWindow);
  51.     ++windowDisableCount;
  52.     return;
  53. }
  54.  
  55. __inline void
  56. EnableWindow (void)
  57. {
  58.     if (windowDisableCount)
  59.     {
  60.         if (!(--windowDisableCount))
  61.         EndRequest(&disable_req, mainWindow);
  62.     }
  63.     return;
  64. }
  65.  
  66. --
  67.   //   Michael B. Smith
  68. \X/    mbs@adastra.cvl.va.us
  69.